package com.acane.instagram.ui

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import com.acane.instagram.feature.chat.chatScreen
import com.acane.instagram.feature.chat.navigateToChat
import com.acane.instagram.feature.collection.collectionListScreen
import com.acane.instagram.feature.collection.collectionScreen
import com.acane.instagram.feature.collection.navigateToCollection
import com.acane.instagram.feature.collection.navigateToCollectionList
import com.acane.instagram.feature.follow.followScreen
import com.acane.instagram.feature.follow.navigateToFollow
import com.acane.instagram.feature.friend.friendScreen
import com.acane.instagram.feature.friend.navigateToFriend
import com.acane.instagram.feature.home.homeScreen
import com.acane.instagram.feature.login.loginScreen
import com.acane.instagram.feature.login.navigateToLogin
import com.acane.instagram.feature.main.SPLASH_ROUTE
import com.acane.instagram.feature.main.mainScreen
import com.acane.instagram.feature.main.navigateToMain
import com.acane.instagram.feature.main.splashScreen
import com.acane.instagram.feature.me.account.editMeScreen
import com.acane.instagram.feature.me.account.navigateToEditMe
import com.acane.instagram.feature.me.meScreen
import com.acane.instagram.feature.me.navigateToMe
import com.acane.instagram.feature.notification.navigateToNotification
import com.acane.instagram.feature.notification.notificationScreen
import com.acane.instagram.feature.post.navigateToPost
import com.acane.instagram.feature.post.postScreen
import com.acane.instagram.feature.postDetail.navigateToPostDetail
import com.acane.instagram.feature.postDetail.postDetailScreen
import com.acane.instagram.feature.profile.navigateToProfile
import com.acane.instagram.feature.profile.profileScreen
import com.acane.instagram.feature.register.navigateToRegister
import com.acane.instagram.feature.register.registerScreen
import com.acane.instagram.feature.search.navigateToSearchDetail
import com.acane.instagram.feature.search.searchDetailScreen
import com.acane.instagram.feature.search.searchScreen

@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
@Composable
fun MyInstagram(navController: NavHostController) {
    NavHost(navController = navController, startDestination = SPLASH_ROUTE) {
        splashScreen(
            toMain = navController::navigateToLogin,
        )

        mainScreen(
            toProfile = navController::navigateToProfile,
            toLogin = navController::navigateToLogin,
            toMain = navController::navigateToMain,
            toFriend = navController::navigateToFriend,
            toMe = navController::navigateToMe,
            toPost = navController::navigateToPost,
            toNotification = navController::navigateToNotification,
            toFollow = navController::navigateToFollow,
            toSearchDetail = navController::navigateToSearchDetail,
            toEditMe = navController::navigateToEditMe,
            toRegister = navController::navigateToRegister,
            toCollection = navController::navigateToCollection,
        )

        searchScreen(
            navController = navController,
            toSearchDetail = navController::navigateToSearchDetail,
        )

        searchDetailScreen(
            navController = navController,
            toProfile = navController::navigateToProfile,
            toPost = navController::navigateToPost,
            toDetail = navController::navigateToPostDetail,
        )

        homeScreen(
            toFriend = navController::navigateToFriend,
            toNotification = navController::navigateToNotification,
        )
        meScreen(
            toLogin = navController::navigateToLogin,
            toMain = navController::navigateToMain,
            toProfile = navController::navigateToProfile,
            toPost = navController::navigateToPost,
            toFollow = navController::navigateToFollow,
            toEditMe = navController::navigateToEditMe,
            toRegister = navController::navigateToRegister,
            toCollection = navController::navigateToCollection,
        )
        collectionScreen(
            navController = navController,
            toProfile = navController::navigateToProfile,
            toPost = navController::navigateToPost,
            toCollectionList = navController::navigateToCollectionList,
        )
        collectionListScreen(
            navController = navController,
            toProfile = navController::navigateToProfile,
        )
        editMeScreen(
            navController = navController,
            toLogin = navController::navigateToLogin,
        )
        profileScreen(
            navController = navController,
            toProfile = navController::navigateToProfile,
            toChat = navController::navigateToChat,
            toPost = navController::navigateToPost,
            toFollow = navController::navigateToFollow,
            toEditMe = navController::navigateToEditMe,
        )
        chatScreen(
            navController = navController,
            toProfile = navController::navigateToProfile,
        )
        friendScreen(
            navController = navController,
            toChat = navController::navigateToChat,
            toFriend = navController::navigateToFriend,
            toLogin = navController::navigateToLogin,
            toRegister = navController::navigateToRegister,
            toMain = navController::navigateToMain,
        )
        postScreen(
            toProfile = navController::navigateToProfile,
            navController = navController,
        )
        notificationScreen(
            toProfile = navController::navigateToProfile,
            navController = navController,
            toPostDetail = navController::navigateToPostDetail,
        )
        postDetailScreen(
            navController = navController,
            toProfile = navController::navigateToProfile,
        )
        followScreen(
            navController = navController,
            toProfile = navController::navigateToProfile,
        )

        loginScreen(
            toMain = navController::navigateToMain,
            toRegister = navController::navigateToRegister,
        )

        registerScreen(
            navController = navController,
            toLogin = navController::navigateToLogin
        )
    }
}